home *** CD-ROM | disk | FTP | other *** search
- package horst;
-
- import java.awt.Component;
- import java.awt.Cursor;
- import java.io.IOException;
- import java.io.Reader;
- import java.net.URL;
- import java.net.URLConnection;
- import javax.swing.JOptionPane;
- import javax.swing.SwingUtilities;
-
- class HTMLPane$ParsingThread implements Runnable {
- // $FF: synthetic field
- private final HTMLPane this$0;
- URL url;
- boolean bAddToHistory;
- // $FF: renamed from: r java.io.Reader
- Reader field_0;
-
- HTMLPane$ParsingThread(HTMLPane this$0, Reader reader, URL baseURL, boolean bAddToHistory) {
- this.this$0 = this$0;
- this.this$0 = this$0;
- this.field_0 = reader;
- this.url = baseURL;
- this.bAddToHistory = bAddToHistory;
- }
-
- HTMLPane$ParsingThread(HTMLPane this$0, URL url, boolean bAddToHistory) {
- this.this$0 = this$0;
- this.this$0 = this$0;
- this.url = url;
- this.bAddToHistory = bAddToHistory;
- }
-
- public void run() {
- String contentType = "";
- if (this.field_0 != null) {
- if (this.this$0.beginParsing(this.field_0, this.url)) {
- if (this.bAddToHistory) {
- this.this$0.m_props.m_history.add(this.url);
- }
-
- SwingUtilities.invokeLater(new HTMLPane.RenderingThread(this.this$0, this.field_0, this.url));
- }
-
- this.this$0.m_bParsing = false;
- this.this$0.setCursor(Cursor.getPredefinedCursor(0));
- } else if (this.url != null) {
- URLConnection con = null;
-
- try {
- this.this$0.notifyStatusListeners(0, this.url);
- con = this.url.openConnection();
- contentType = con.getContentType();
- } catch (IOException e) {
- System.out.println("Exception : " + ((Throwable)e).getMessage());
- this.this$0.m_bParsing = false;
- return;
- }
-
- if (!this.this$0.notifyStatusListeners(6, contentType)) {
- this.this$0.m_bParsing = false;
- return;
- }
-
- if (contentType == null) {
- contentType = "text/html";
- }
-
- contentType.trim();
- if (!"image/jpeg".equals(contentType) && !"image/gif".equals(contentType) && !"image/jpg".equals(contentType)) {
- if (!contentType.startsWith("text/html") && !contentType.startsWith("text/plain")) {
- JOptionPane.showMessageDialog((Component)null, "Invalid content type: " + contentType, "Error", 0);
- this.this$0.notifyStatusListeners(9, this.this$0.m_document.getURL());
- } else if (this.this$0.beginParsing(con)) {
- if (this.bAddToHistory) {
- this.this$0.m_props.m_history.add(this.url);
- }
-
- SwingUtilities.invokeLater(new HTMLPane.RenderingThread(this.this$0, (URL)null));
- }
- } else {
- this.this$0.loadImageContent(this.url);
- }
-
- this.this$0.m_bParsing = false;
- }
-
- }
- }
-